package xyz.erupt.flow.controller;

import com.alibaba.fastjson.JSONObject;
import lombok.var;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.*;
import xyz.erupt.core.annotation.EruptRouter;
import xyz.erupt.core.constant.EruptRestPath;
import xyz.erupt.core.view.EruptApiModel;
import xyz.erupt.flow.bean.entity.erupt.EruptUserSign;
import xyz.erupt.flow.constant.FlowConstant;
import xyz.erupt.flow.repository.EruptUserSignRepository;
import xyz.erupt.flow.service.EruptUserSignService;
import xyz.erupt.upms.service.EruptUserService;

import javax.annotation.Resource;

/**
 * @author PP
 * @version 1.0
 * @project Erupt
 * @description 用户签名
 * @date 2024/9/24 11:51:44
 */
@RestController
@RequestMapping(EruptRestPath.ERUPT_API + "/" + FlowConstant.SERVER_NAME)
public class EruptUserSignController {
    @Resource
    private EruptUserSignService eruptUserSignService;

    @PostMapping("/sign/save")
    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN)
    public EruptApiModel SaveSign(@RequestBody String sign) {
        eruptUserSignService.Save(sign);
        return EruptApiModel.successApi();
    }

    //获取签名
    @GetMapping("/sign/get_sign")
    @EruptRouter(verifyType = EruptRouter.VerifyType.LOGIN)
    public EruptApiModel GetSign(){
        var sign = eruptUserSignService.GetSign();
        return EruptApiModel.successApi(sign);
    }
}
